package com.bytecodezz.app.photoshop.loader.core

import android.app.Activity
import android.content.Context
import androidx.fragment.app.Fragment

/**
 * PhotoshopLoaderAPI类，对外提供进行使用
 * 单例设计模式
 * 具体业务逻辑交由 PhotoshopLoaderManager进行管理
 */
class PhotoshopLoader private constructor() {
    companion object {
        fun get() = Holder.instance

        /**
         * 可选择其中一个参数进行传入
         * 如果都未传，默认使用getApplication获取到
         */
        fun with(
            activity: Activity? = null,
            fragment: Fragment? = null,
            context: Context? = null
        ): PhotoshopLoaderManager = PhotoshopLoaderManager.with(activity, fragment, context)
    }

    private object Holder {
        val instance = PhotoshopLoader()
    }
}